package com.casic.ops.entity.vo.pipeline.response;

/**
 * 通用Response类
 */
public class Response  {

    private static final long serialVersionUID = 1L;

    private Integer code = 200;//默认成功

    private String msg = "执行成功";//操作成功

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String message) {
        this.msg = message;
    }

    @Override
    public String toString() {
        return "Response [code=" + code + ", message=" + msg + "]";
    }

    public static Response success() {
        Response response = new Response();
        return response;
    }

    public static Response success(String message) {
        Response response = new Response();
        response.setMsg(message);
        return response;
    }

    public static Response error(Integer code, String message) {
        Response response = new Response();
        response.setCode(code);
        response.setMsg(message);
        return response;
    }

    public static Response error(String message) {
        Response response = new Response();
        response.setCode(500);
        response.setMsg(message);
        return response;
    }

}
